import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;

/**
 * @author 帅小伙
 * @date 2022/1/2
 * @description
 */
public class Task06 {

    private static final String NORMAL_EXCHANGE_NAME = "normal_exchange";

    public static void main(String[] args) throws Exception {
        Channel channel = RabbitMqUtils.getChannel();
        channel.exchangeDeclare(NORMAL_EXCHANGE_NAME, BuiltinExchangeType.DIRECT);

        String message = "info";
        // 给消息一个TTL时间     时间到期没有被消费之后进入死信队列
        AMQP.BasicProperties properties = new AMQP.BasicProperties().builder().expiration("5000").build();
        channel.basicPublish(NORMAL_EXCHANGE_NAME,"zansan",properties,message.getBytes());


    }


}
